﻿using Domain.Model;
using Domain.Types;
using System;
using System.Collections.Generic;
using System.Text;

namespace DTO
{
    public class BlackListOutput
    {
        /// <summary>
        /// 账号
        /// </summary>
        public string Phone { get; set; }
        /// <summary>
        /// 原因
        /// </summary>
        public string Reson { get; set; }
        /// <summary>
        /// 恢复时间
        /// </summary>
        public string RestoreTime { get; set; }
        /// <summary>
        /// 禁止用的权限
        /// </summary>
        public string BlackListPermissions { get; set; }

        public static List<BlackListOutput> Persion(List<BlackListAggregate> list)
        {
            List<BlackListOutput> blackListOutputs = new List<BlackListOutput>();

            foreach (var item in list)
            {
                BlackListOutput blackListOutput = new BlackListOutput();

                blackListOutput.Phone = item.Phone;                
                blackListOutput.BlackListPermissions = item.BlackListPermissions.ToString();
                blackListOutput.Reson = item.Reson;
                blackListOutput.RestoreTime = item.RestoreTime?.ToString("yyyy-MM-dd")??"永不恢复";

                blackListOutputs.Add(blackListOutput);
            }
            return blackListOutputs;
        }
    }
}
